package com.company.hrmadmin;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

@Slf4j
@SpringBootApplication
@MapperScan("com.company.hrmadmin.modules.mapper")
public class HrmAdminApplication {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext application = SpringApplication.run(HrmAdminApplication.class, args);
        Environment env = application.getEnvironment();
        log.info("\n--------------------------------------------------------------------------------------------------------------------\n\t" +
                        "CompanyApplication '{}' is running! Access URLs:\n\t" +
                        "Local: \t\thttp://localhost:{}/\n\t" +
                        "External: \thttp://{}:{}/\t" +
                        "\n--------------------------------------------------------------------------------------------------------------------",
                "CompanyApplication Server Application v1.0",
                env.getProperty("server.port"),
                InetAddress.getLocalHost().getHostAddress(),
                env.getProperty("server.port"));
    }

}
